package com.baturu.vin.byd.dal.dao;

import com.baturu.vin.byd.dto.BydPartsMappingDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

public interface BydPartsMappingDAO {

    @Select({"<script>select distinct partsCode, btrPartsName from byd_parts_mapping",
            "where btrPartsName in ",
            "<foreach item='item' index='index' collection='btrPartsNames' open='(' separator=',' close=')' >",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<BydPartsMappingDTO> getByBtrPartsName(@Param("btrPartsNames") Collection<String> btrPartsNames);

    @Select({"<script>select distinct partsCode, btrPartsName from byd_parts_mapping",
            "where partsCode in ",
            "<foreach item='item' index='index' collection='partsCode' open='(' separator=',' close=')' >",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<BydPartsMappingDTO> getByPartsCode(@Param("partsCode") Collection<String> partsCodes);
}